# locust777

//输出一个为不超过五位的数字
//1.输出位数
//2.顺序输出
//3.逆序输出
#include<stdio.h>
int main()
{
	int num = 0;
	//设置不同的字母接收每位数
	int Ind=0,Ten=0,Han=0,Tho=0,HanTho=0;//分别是个，十，百，千，万
	printf("请输入一个不超过五位数字：");
	scanf("%d",&num);
	//HanTho = num / 10000;
	//Tho = (num % 10000) / 1000;
	//Han = (num % 1000) / 100;
	//Ten = (num % 100) / 10;
	//Ind = num % 10;
	if(num < 99999)
	{
	if(num / 10000 != 0)
	{
	HanTho = num / 10000;
	Tho = (num % 10000) / 1000;
	Han = (num % 1000) / 100;
	Ten = (num % 100) / 10;
	Ind = num % 10;
		printf("这是五位数\n");
	    printf("顺序输出:%d%d%d%d%d\n",Ind,Ten,Han,Tho,HanTho);
		printf("逆序输出:%d%d%d%d%d\n",HanTho,Tho,Han,Ten,Ind);
	}
	else if(num / 1000 != 0)
	{
	Tho = (num % 10000) / 1000;
	Han = (num % 1000) / 100;
	Ten = (num % 100) / 10;
	Ind = num % 10;
		printf("这是四位数字\n");
	    printf("顺序输出:%d%d%d%d\n",Ind,Ten,Han,Tho);
		printf("逆序输出:%d%d%d%d\n",Tho,Han,Ten,Ind);
	}
	else if(num / 100 != 0)
	{
	Han = (num % 1000) / 100;
	Ten = (num % 100) / 10;
	Ind = num % 10;
		printf("这是三位数字\n");
	    printf("顺序输出:%d%d%d\n",Ind,Ten,Han);
		printf("逆序输出:%d%d%d\n",Han,Ten,Ind);
	}
	else if(num / 10 != 0)
	{
	Ten = (num % 100) / 10;
	Ind = num % 10;
		printf("这是二位数字\n");
		printf("顺序输出:%d%d\n",Ind,Ten);
		printf("逆序输出:%d%d\n",Ten,Ind);
	}
	else
	{
	Ind = num % 10;
		printf("这是一位数字\n");
	    printf("顺序输出:%d\n",Ind);
		printf("逆序输出:%d\n",Ind);
	}
	}
	else
		printf("输入错误，请重新输入");
	scanf("%d",num);
return 0;
}

